<template>
	<div id="contentBox">
	
		<div id="tableBox" style="margin:25px 25px 0" >
			<el-table :data="tableData.data" border  >
			    <el-table-column label="资金方" >
			      <template scope="scope">
			        <span v-if="scope.row.sysUsers" >{{ scope.row.sysUsers.realname }}</span>
			      </template>
			    </el-table-column>
			    <el-table-column label="合同别名" >
			      <template scope="scope">
			        <span >{{ scope.row.name }}</span>
			      </template>
			    </el-table-column>
			    <el-table-column label="合同名称" >
			      <template scope="scope">
			        <span >{{ scope.row.outName }}</span>
			      </template>
			    </el-table-column>
			    <el-table-column label="合同模板编号" >
			      <template scope="scope">
			        <span >{{ scope.row.templateNumber }}</span>
			      </template>
			    </el-table-column>
			  <!--   <el-table-column label="合同生成方式" >
			      <template scope="scope">
			        <span >{{ scope.row.px }}</span>
			      </template> -->
			    </el-table-column>
			    <el-table-column label="启用状态" width="100">
			      <template scope="scope">
			        <span >{{ scope.row.enable | flagF }}</span>
			      </template>
			    </el-table-column>
			  <!--   <el-table-column label="备注" >
			      <template scope="scope">
			        <span >{{ scope.row.rmpp }}</span>
			      </template> -->
			    </el-table-column>
			    
			    <el-table-column label="操作" width="180">
			      <template scope="scope">
			      	<!-- <el-button size="small" @click="handleEdit(scope.$index, scope.row)">审核</el-button> -->
			        <el-button size="small" type="primary" @click="handleEdit(scope.$index, scope.row ,true)">编辑</el-button>
			        <el-button size="small" type="success" @click="handleSee(scope.$index, scope.row )">查看</el-button>
			        <el-button size="small" type="danger" @click="handleDelete(scope.$index, scope.row)">{{ scope.row.enable | flag }}</el-button>
			      </template>
			    </el-table-column>
			</el-table>
			<el-dialog  title="合同模板管理" :visible.sync="dialogFormVisible" top="5%" v-if="dialogFormVisible">
                <el-card class="box-card">
				  <!-- <div slot="header" class="clearfix">
				    <span style="line-height: 30px;"></span>
				  </div> --> 
				  <div  class="text item" >
					  <el-form :model="dialogForm" ref="dialogForm">
					    <el-form-item label="资金方" :label-width="formLabelWidth" prop="qcsl">
					      <el-select v-model="dialogForm.funderId" filterable placeholder="请选择资金方" :disabled="!isAdd">
						    <el-option
						      v-for="item in funderUserList"
						      :key="item.id"
						      :label="item.realname"
						      :value="item.id">
						    </el-option>
						  </el-select>
					    </el-form-item> 
					    <el-form-item label="合同别名" :label-width="formLabelWidth" prop="qcsl">
					      <el-input v-model="dialogForm.name"  auto-complete="off" :disabled="!isAdd"></el-input>
					    </el-form-item>
					     <el-form-item label="合同名称" :label-width="formLabelWidth" prop="qcsl">
					      <el-input v-model="dialogForm.outName"  auto-complete="off" :disabled="!isAdd"></el-input>
					    </el-form-item>
					    <!--  <el-form-item label="合同类型" :label-width="formLabelWidth" prop="qcsl">
					      <el-input v-model="dialogForm.qcsl"  auto-complete="off" :disabled="!isAdd"></el-input>
					    </el-form-item> -->
					     <el-form-item label="合同模板编号" :label-width="formLabelWidth" prop="qcsl">
					      <el-input v-model="dialogForm.templateNumber"  auto-complete="off" :disabled="!isAdd"></el-input>
					    </el-form-item>

					    <el-form-item label="合同类型" :label-width="formLabelWidth"  prop="qcsl">
					      <el-select v-model="dialogForm.apiType" filterable placeholder="请选择合同类型" :disabled="!isAdd">
						    <el-option   label="垫资合同" :value.number="1">
						    </el-option>
						    <el-option   label="库融合同" :value.number="2">
						    </el-option>
						  </el-select>
					    </el-form-item>  
					    <!--  <el-form-item label="云合同appId" :label-width="formLabelWidth" prop="qcsl">
					      <el-input v-model="dialogForm.qcsl"  auto-complete="off" :disabled="!isAdd"></el-input>
					    </el-form-item>
					     <el-form-item label="云合同密码" :label-width="formLabelWidth" prop="qcsl">
					      <el-input v-model="dialogForm.qcsl"  auto-complete="off" :disabled="!isAdd"></el-input>
					    </el-form-item> -->
					    <el-form-item label="参与签署方" :label-width="formLabelWidth" >
					      
					    <el-checkbox-group v-model="dialogForm.signatory">
							      <template>
							      	  <el-checkbox :disabled="!isAdd" label="lscInclued" name="type1">链上车</el-checkbox>
									  <el-input-number :disabled="!isAdd" v-model="dialogForm.lscSignNumber" :min="1" :max="10" label="签署次数"></el-input-number>
								  </template> 

								   <template>
							      	  <el-checkbox :disabled="!isAdd" label="lscSpvInclued" name="type5">链上车SPV</el-checkbox>
									  <el-input-number v-model="dialogForm.lscSpvSignNumber"  :disabled="!isAdd"  :min="1" :max="10" label="签署次数"></el-input-number>
								  </template> 

								   <template>
							      	  <el-checkbox :disabled="!isAdd" label="dealerInclued" name="type2">经销商</el-checkbox>
									  <el-input-number v-model="dialogForm.jxsSignNumber" :disabled="!isAdd"   :min="1" :max="10" label="签署次数"></el-input-number>
								  </template> 

								  <template>
							      	  <el-checkbox :disabled="!isAdd" label="funderInclued" name="type3">资金方</el-checkbox>
									  <el-input-number v-model="dialogForm.zjfSignNumber" :disabled="!isAdd"   :min="1" :max="10" label="签署次数"></el-input-number>
								  </template>

								  <template>
							      	  <el-checkbox :disabled="!isAdd" label="spvInclued" name="type4">SPV</el-checkbox>
									  <el-input-number v-model="dialogForm.spvSignNumber"  :disabled="!isAdd"  :min="1" :max="10" label="签署次数"></el-input-number>
								  </template> 

								  <template>
							      	  <el-checkbox :disabled="!isAdd" label="lscSpvLoaneeInclued" name="type5">链上车借款人</el-checkbox>
									  <el-input-number v-model="dialogForm.lscSpvLoaneeNumber"  :disabled="!isAdd"  :min="1" :max="10" label="签署次数"></el-input-number>
								  </template> 


						    </el-checkbox-group>
					    </el-form-item> 
					    
					   <!--  <el-form-item label="合同生成方式" :label-width="formLabelWidth" prop="priceStatus">
					      <el-radio-group v-model="dialogForm.priceStatus" :disabled="!isAdd">
						      <el-radio :label="1"  >SDK</el-radio>
						      <el-radio :label="2"  >API</el-radio>
					      </el-radio-group>
					    </el-form-item> -->
					    <el-form-item label="备注" :label-width="formLabelWidth" prop="qcsl">
					      <el-input v-model="dialogForm.remark" type="textarea" :rows=3 auto-complete="off" :disabled="!isAdd"></el-input>
					    </el-form-item>
					    
					  </el-form>
					</div>
				</el-card>
				<div slot="footer" class="dialog-footer" >
				   <el-button @click="dialogFormVisible = false;">返 回</el-button>
				   <el-button v-if="isAdd" type="primary" @click="parametersDialog">添加参数</el-button>
				   <el-button v-if="isAdd" type="primary" @click="submitDialogForm">提 交</el-button>
				</div>
			</el-dialog>
			<el-dialog title="合同参数" :visible.sync="dialogFormVisible1">
				 
					<el-form :model="dialogForm" ref="dialogForm">
						<el-form-item    label="占位符" v-for="(item,index) in dialogForm.parametersVO" :label-width="formLabelWidth"  :key="index">    
					    	<el-row :gutter="20"  >
					    		<el-col :span="14">
					    			<el-input  v-model="dialogForm.parametersVO[index]" auto-complete="off"></el-input>
					    		</el-col>
					    		<el-col :span="8">
					    			<el-button type="primary" @click="addRows(index)"  size="small">添加行</el-button>
					  	            <el-button type="primary" @click="delRows(index)"  size="small">删除行</el-button>
					    		</el-col>
					    	</el-row> 
				    	</el-form-item>
					</el-form>
			</el-dialog> 
		</div>
        <div class="block" style="text-align: center;margin-top: 15px;position:relative;">
		    <pagination v-on:refreshSeachData="seachData"  :tableData="tableData" :searchForm="searchForm"></pagination>
		    <el-button  style="position:absolute;right:25px;top:0;" type="primary" @click="handleEdit()">添加合同模板</el-button>
		</div>
		
	</div>
	
</template>
<script src="./index.js"></script>
<style scoped lang="stylus">
	@import "./index.styl"
</style>